package cn.lili.modules.order.order.callback;

import cn.lili.common.vo.ResponseBean;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.goods.entity.vos.yunxin.CallBackVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

import javax.security.auth.callback.Callback;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;

/**
 * 工厂类
 */
@Component
public class OrderFactory {

    @Autowired
    private Map<String, MessageType> messageTypeMap;

    public ResponseBean execute(CallBackVO callBackVO) {
        MessageType messageType = messageTypeMap.get(callBackVO.getMessage_type());
        if (messageType == null) {
            return new ResponseBean(0, "无匹配类型无需处理", new HashMap<>());
        }
        return messageType.execute(callBackVO);
    }
}
